<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" th:with="title='保存文章',active='publish'">
<header th:replace="~{admin/fragments/header::headerFragment(${title},${active})}"></header>
<link th:href="@{/admin/plugins/tagsinput/jquery.tagsinput.css}" rel="stylesheet"/>
<link th:href="@{/admin/plugins/select2.dist.css/select2-bootstrap.css}" rel="stylesheet"/>
<link th:href="@{/admin/plugins/toggles/toggles.css}" rel="stylesheet"/>

<link href="//cdn.bootcss.com/multi-select/0.9.12/css/multi-select.css" rel="stylesheet"/>
<link href="//cdn.bootcss.com/select2/3.4.8/select2.min.css" rel="stylesheet"/>
<link th:href="@{/admin/plugins/md/css/style.css}" rel="stylesheet"/>
<!-- editor.md -->
<link th:href="@{/admin/editormd/css/editormd.css}" rel="stylesheet"/>
<style>
    #tags_tagsinput {
        background-color: #fafafa;
        border: 1px solid #eeeeee;
    }

    #tags_addTag input {
        width: 100%;
    }

    #tags_addTag {
        margin-top: -5px;
    }
</style>
<body class="fixed-left">
<div id="wrapper">
    <div th:replace="~{admin/fragments/header::header-body}"></div>
    <div class="content-page">
        <div class="content">
            <div class="container">
                <div class="row">
                    <div class="col-sm-12">
                        <h4 class="page-title">
                                文章撰写
                        </h4>
                    </div>
                    <div class="col-md-12">
                        <form id="articleForm" role="form" novalidate="novalidate">
<!--                            文章内容-->
                            <input type="hidden" id="content-editor" name="content">
<!--                            状态 1发布/2未发布-->
                            <input type="hidden" id="status" name="status">
<!--                            是否允许评论-->
                            <input type="hidden" id="allow_comment" name="allowcomment" value="1">
                            <div class="form-group col-md-6">
                                文章标题
                                <input type="text" id="title" class="form-control" placeholder="请输入文章标题" name="title" required="required" aria-required="true">
                            </div>
                            <div class="form-group col-md-6">
                                文章描述
                                <input type="text" id="description" name="description" class="form-control" placeholder="请输入文章描述" required="required" aria-required="true">
                            </div>
                            <div class="form-group col-md-6">
                               文章标签<select id="tags"  name="tags" class="select2 select form-control" multiple="multiple"
                                        data-placeholder="请选择文章标签">
                                </select>
                            </div>
                            <div class="form-group col-md-6" >
                                文章分类<select id="categories" name="categoriesid" class="combobox form-control">
                                </select>
                            </div>

                            <div class="clearfix"></div>
                            <div id="my-editormd" >
                                <textarea id="my-text" name="my-text" style="display:none;" class="markdown-textarea"></textarea>
                                <!-- 注意：name属性的值-->
                                <textarea id="text" name="text" style="display:none;" ></textarea>
                            </div>
                            <!--<div class="form-group">-->
                                <!--<textarea style="height: 450px" autocomplete="off" id="text" name="text"-->
                                          <!--class="markdown-textarea"-->
                                          <!--th:utext="${contents!=null and contents.content !=null}?${contents.content}: ''"></textarea>-->
                            <!--</div>-->

                            <div class="form-group col-md-3 col-md-offset-1" id="comment-div">
                                开启评论
                                <div>
                                    <div class="toggle toggle-success allow-true" id="allow"></div>
                                </div>
                            </div>
                            <div class="clearfix"></div>

                            <div class="text-right">
                                <a class="btn btn-default waves-effect waves-light" th:href="@{/admin/article/manage}">返回列表</a>
                                <button type="button" class="btn btn-primary waves-effect waves-light"
                                        onclick="subArticle(1);">
                                    保存文章
                                </button>
                                <button type="button" class="btn btn-warning waves-effect waves-light"
                                        onclick="subArticle(0);">
                                    存为草稿
                                </button>
                            </div>
                        </form>
                    </div>
                </div>
                <div th:replace="admin/fragments/footer :: footer-content"></div>
            </div>
        </div>
    </div>
</div>
<div th:replace="admin/fragments/footer :: footer"></div>
<script type="text/javascript">
    $(function() {
        editormd("my-editormd", {//注意1：这里的就是上面的DIV的id属性值
            width   : "90%",
            height  : 640,
            syncScrolling : "single",
            path    : "/admin/editormd/lib/",//原资源文件中lib包在我们项目中所放的位置
            saveHTMLToTextarea : true,//注意3：这个配置，方便post提交表单
            /**上传图片相关配置如下*/
            imageUpload: true,
            imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp"], //图片上传格式
            imageUploadURL: baseurl+api.imgupload,
            onload: function (obj) { //上传成功之后的回调
            }
        });
    });
</script>
<script th:src="@{/admin/plugins/tagsinput/jquery.tagsinput.min.js}"></script>
<script th:src="@{/admin/plugins/jquery-multi-select/jquery.quicksearch.js}"></script>
<!-- editor.md -->
<script th:src="@{/admin/editormd/src/editormd.js}"></script>
<script th:src="@{//cdn.bootcss.com/multi-select/0.9.12/js/jquery.multi-select.min.js}"></script>
<script th:src="@{//cdn.bootcss.com/select2/3.4.8/select2.min.js}"></script>
<script th:src="@{//cdn.bootcss.com/jquery-toggles/2.0.4/toggles.min.js}"></script>
<script type="text/javascript" src="/admin/js/api.js"></script>
<script th:src="@{/admin/js/article.js}"></script>
</body>
</html>